var path = require('path')
var webpack = require('webpack')
var CleanWebpackPlugin = require('clean-webpack-plugin').CleanWebpackPlugin

function resolve(p) {
  return path.resolve(__dirname, p)
}
var vendor = ['react', 'react-dom', 'vue', 'jquery', 'lodash']
module.exports = {
  mode: 'production',
  entry: {
    vendor
  },
  output: {
    library: '[name]__[chunkhash]',
    filename: '[name].[chunkhash].js',
    path: resolve('./dll')
  },
  plugins: [
    new CleanWebpackPlugin(),
    new webpack.DllPlugin({
      path: './dll/manifest.json',
      name: '[name]__[chunkhash]',
      context: __dirname
    })
  ]
}
